import optionsx from '@/Echarts/饼图1'
import * as echarts from 'echarts'
let options = JSON.parse(JSON.stringify(optionsx))

export default (element, data) => {
  const old = echarts.getInstanceByDom(element)
  if (old) old.dispose()
  const chart = echarts.init(element, 'theme')
  options.legend.data = data.legendData || [];
  options.series[0].name = data.name || '';
  options.series[0].data = data.seriesData || [];
  options.series[0].radius = [40,110];
  chart.setOption(options)
  return chart
}
